//获取应用实例


const app = getApp()
Page({
  data: {
    region: [app.globalData.province, app.globalData.city, app.globalData.county],
  },
 
 /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (e) {
    var that = this;
    console.log(app.globalData.province)
    that.setData({
      region: [app.globalData.province, app.globalData.city, app.globalData.county],
    })
  },
  bindRegionChange: function (e) {
    console.log(e.detail.value)
    console.log(e.detail.value[0], e.detail.value[1], e.detail.value[2])
    this.setData({
      region: e.detail.value
    })
  },
  bindCancel: function () {
    wx.navigateBack({})
  },
  //验证
  bindSave: function (e) {
    var that = this;
    var linkMan = e.detail.value.linkMan;
    var address = e.detail.value.address;
    var mobile = e.detail.value.mobile;
    var code = e.detail.value.code;

    if (linkMan == "") {
      wx.showModal({
        title: '提示',
        content: '请填写联系人姓名',
        showCancel: false
      })
      return
    }
    if (mobile == "") {
      wx.showModal({
        title: '提示',
        content: '请填写手机号码',
        showCancel: false
      })
      return
    }

    if (address == "") {
      wx.showModal({
        title: '提示',
        content: '请填写详细地址',
        showCancel: false
      })
      return
    }
    if (code == "") {
      wx.showModal({
        title: '提示',
        content: '请填写邮编',
        showCancel: false
      })
      return
    }
  },
  
})